package com.gzdh.dishrecognition.config;

import android.content.Context;
import android.content.SharedPreferences;

import com.gzdh.dishrecognition.AppContext;

public class IdfConst {

    private static IdfConst idfConst;

    public static IdfConst getInstance() {
        if (idfConst == null) {
            idfConst = new IdfConst();

        }
        return idfConst;
    }

    private SharedPreferences sharedPreferences;

    private SharedPreferences.Editor editor;


    public IdfConst() {
        sharedPreferences = AppContext.getInstance().getSharedPreferences("idfCost", Context.MODE_PRIVATE); //私有数据
        editor = sharedPreferences.edit();
        cameraId = sharedPreferences.getString("cameraId", null);
        width = sharedPreferences.getInt("width", 0);
        height = sharedPreferences.getInt("height", 0);
        idfSystemUrl = sharedPreferences.getString("idfSystemUrl", "http://172.10.0.100:8011");
        idfServiceUrl = sharedPreferences.getString("idfServiceUrl", "http://172.10.0.100:8081");
    }


    private String cameraId;

    private int width;

    private int height;


    private String idfSystemUrl;

    private String idfServiceUrl;

    public String getCameraId() {
        return cameraId;
    }

    public void setCameraId(String cameraId) {
        this.cameraId = cameraId;
        editor.putString("cameraId", cameraId);
        editor.apply();
    }


    public int getWidth() {
        return width;
    }

    public void setWidth(int width) {
        this.width = width;
        editor.putInt("width", width);
        editor.apply();
    }

    public int getHeight() {
        return height;
    }

    public void setHeight(int height) {
        this.height = height;
        editor.putInt("height", height);
        editor.apply();
    }

    public String getIdfSystemUrl() {
        return idfSystemUrl;
    }

    public void setIdfSystemUrl(String idfSystemUrl) {
        this.idfSystemUrl = idfSystemUrl;
        editor.putString("idfSystemUrl", idfSystemUrl);
        editor.apply();
    }

    public String getIdfServiceUrl() {
        return idfServiceUrl;
    }

    public void setIdfServiceUrl(String idfServiceUrl) {
        this.idfServiceUrl = idfServiceUrl;
        editor.putString("idfServiceUrl", idfServiceUrl);
        editor.apply();
    }
}
